package com.hdu.hdu.chainFactory;



import com.hdu.hdu.chain.InterceptorChain;
import com.hdu.hdu.context.StudentInfoCheckContext;
import com.hdu.hdu.interceptor.Interceptor;
import com.hdu.hdu.interceptorFIlter.InterceptorFilter;
import com.hdu.hdu.invoker.StudentSaveInvoker;

import java.util.Arrays;
import java.util.List;


/**
 * 构建具体的拦截器链 + invoker
 */
public class InterceptorChainFactory {


    @SafeVarargs
    public static InterceptorChain<StudentInfoCheckContext> createStudentCheckInterceptorChain(
            InterceptorFilter interceptorFilter,
            Interceptor<StudentInfoCheckContext>... interceptors) {
        List<Interceptor<StudentInfoCheckContext>> interceptorList = Arrays.asList(interceptors);
        return new InterceptorChain<>(interceptorFilter, interceptorList, new StudentSaveInvoker());
    }

}
